Support submodule types in the data mapper#426
Merged
nipunayf merged 4 commits intoballerina-platform:1.2.xfrom Oct 25, 2025
Merged
Support submodule types in the data mapper#426nipunayf merged 4 commits intoballerina-platform:1.2.xfrom
nipunayf merged 4 commits intoballerina-platform:1.2.xfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for handling local submodule types in the data mapper by filtering out submodules when retrieving imports and directly querying their semantic models for type resolution. This prevents the system from attempting to retrieve local submodule types from Ballerina Central.
- Updated the
SourceBuilder.getExpressionBodyTextmethod to identify and handle local submodules separately - Added a failover mechanism that queries the semantic model of local submodules when types cannot be resolved through normal imports
- Includes comprehensive test cases covering various scenarios with local module types (basic usage, parameters, return types, unions, and editing)
Reviewed Changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| SourceBuilder.java | Core logic changes to detect local submodules, filter them from import pulls, and implement failover type resolution for submodule types |
| DataMapperDefinitionBuilder.java | Minor formatting change to method return statement |
| data_mapper_definition11-15.json | Test configuration files for various local module type scenarios |
| nested/nested_editing test files | Test resources defining local submodule structures and type definitions |
Comments suppressed due to low confidence (1)
flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/node/DataMapperDefinitionBuilder.java:1
- Corrected spelling of 'T ype' to 'Type' in the description field.
/*
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
aaca766 to
4be7417
Compare
NipunaRanasinghe
approved these changes
Oct 24, 2025
KavinduZoysa
approved these changes
Oct 24, 2025
142c0b3 to
3ee1769
Compare
madushajg
approved these changes
Oct 25, 2025
3ee1769 to
ab8f2f8
Compare
This was referenced Oct 26, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
This PR enhances the handling of project structures that include submodules. Previously, the implementation attempted to pull all imported modules from Ballerina Central, which led to failures when using types defined in local project submodules.
The source builder has been refined to:
Fixes wso2/product-ballerina-integrator#1600
Remarks
The following implementation is a temporary workaround. We need to explore improvements to the semantic APIs to properly handle submodules.